/*
 * GenericDAOException.java
 *
 * Created on 28 de Junho de 2007, 15:05
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.unifor.finance.persistence.dao;

import br.unifor.finance.common.dto.PersistentObject;

/**
 *
 * @author Cleilson
 */
public class GenericDAOException extends java.lang.Exception {
  
  public enum DAOOperation {
    INSERT, UPDATE, DELETE, FIND;
    
    private String getFormatedMessage() {
      return null;
    }
  };
  
  private PersistentObject entityObject;
  
  /**
   * Creates a new instance of <code>GenericDAOException</code> without detail message.
   */
  public GenericDAOException() {
  }
  
  /**
   * Constructs an instance of <code>GenericDAOException</code> with the specified detail message.
   * 
   * @param msg the detail message.
   */
  public GenericDAOException(String msg) {
    super(msg);
  }
  
  /**
   * Constructs an instance of <code>GenericDAOException</code> with the specified detail message.
   * 
   * @param cause the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
   */
  public GenericDAOException(Throwable cause) {
    super(cause);
  }
  
  /**
   * Constructs an instance of <code>GenericDAOException</code> with the specified detail message.
   * 
   * @param msg the detail message.
   * @param cause the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
   */
  public GenericDAOException(String msg, Throwable cause) {
    super(msg, cause);
  }
  
  /**
   * Constructs an instance of <code>GenericDAOException</code> with the specified detail message.
   * 
   * @param msg the detail message.
   * @entityObject the persistent object to this DAO.
   */
  public GenericDAOException(String msg, PersistentObject entityObject) {
    super(msg);
    this.entityObject = entityObject;
  }
  
  /**
   * Constructs an instance of <code>GenericDAOException</code> with the specified detail message.
   * 
   * @param msg the detail message.
   * @entityObject the persistent object to this DAO.
   * @param cause the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
   */
  public GenericDAOException(String msg, PersistentObject entityObject, Throwable cause) {
    super(msg, cause);
    this.entityObject = entityObject;
  }
  
  public PersistentObject getPersistentObject() {
    return entityObject;
  }
}
